package io.shallwe._admin.line;

import java.awt.print.*;

/**
 * @Description: 打印测试类
 * @author: gkw
 * @description: io.shallwe._admin.line
 * @date:2019/9/16
 **/
public class PrintTest {

    public static void main(String[] args) {

        try{
            PrinterJob job = PrinterJob.getPrinterJob();
            if (!job.printDialog()) {
                return;
            }
            double margin=10;

		Book printBook = new Book();
		Paper paper=new Paper();
		paper.setImageableArea(margin, margin, paper.getWidth() - margin * 2, paper.getHeight() - margin * 2);

		PageFormat pf = new PageFormat();
		pf.setPaper(paper);
		printBook.append(new TurnoverVehiclePrintModel("MCY0000011","压缩阀系分总成","30","F20190001","BE312001"),pf);
            // 设置打印页
		job.setPageable(printBook);
            // 设置打印任务名称
		job.setJobName("多页打印");
		job.print(); // 执行打印
        }catch (Exception e){

        }

    }
}
